package com.lin.baby.boot.chapter3.config;

import com.lin.baby.boot.chapter3.service.HelloWordService;
import com.lin.baby.boot.chapter3.service.impl.HelloWordByCnServiceImpl;
import com.lin.baby.boot.chapter3.service.impl.HelloWordServiceImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * Class Desc
 *
 * @author WangYang
 * @version 1.0
 * @datetime 2016/10/14 9:58
 */
@Configuration
public class ProfileConfig {

    @Bean(name = "helloWordService", initMethod = "init", destroyMethod = "destroy")
    @Profile("en")
    HelloWordService enHelloWordService() {
        return new HelloWordServiceImpl();
    }

    @Bean(name = "helloWordService", initMethod = "init", destroyMethod = "destroy")
    @Profile("cn")
    HelloWordService cnHelloWordService() {
        return new HelloWordByCnServiceImpl();
    }

}
